import request from '@/config/axios'

// 问诊消息 VO
export interface ConsultationMessageVO {
  id: number // record_id
  cid: number // 问诊id
  senderId: number // 发送者id
  receiverId: number // 接收方id
  messageContent: string // 消息内容
  messageType: number // 消息类型：1文本，2图片，3音频，4其他
}

// 问诊消息 API
export const ConsultationMessageApi = {
  // 查询问诊消息分页
  getConsultationMessagePage: async (params: any) => {
    return await request.get({ url: `/chat/consultation-message/page`, params })
  },

  // 查询问诊消息详情
  getConsultationMessage: async (id: number) => {
    return await request.get({ url: `/chat/consultation-message/get?id=` + id })
  },

  // 新增问诊消息
  createConsultationMessage: async (data: ConsultationMessageVO) => {
    return await request.post({ url: `/chat/consultation-message/create`, data })
  },

  // 修改问诊消息
  updateConsultationMessage: async (data: ConsultationMessageVO) => {
    return await request.put({ url: `/chat/consultation-message/update`, data })
  },

  // 删除问诊消息
  deleteConsultationMessage: async (id: number) => {
    return await request.delete({ url: `/chat/consultation-message/delete?id=` + id })
  },

  // 导出问诊消息 Excel
  exportConsultationMessage: async (params) => {
    return await request.download({ url: `/chat/consultation-message/export-excel`, params })
  },
}